import request from '@/utils/request'

export function login(form) {
  return request({
    url: '/user/userLogin',
    method: 'post',
    data: form
  })
}

//返回值 data{token,userInfo}
export function register(form) {
  return request({
    url: '/user/register',
    method: 'post',
    data: form
  })
}

//返回值 data{userInfo}
export function getUserInfo(){
  return request({
    url:'/user/userInfo',
    method: 'get',
  })
}

export function getAllUserName() {
  return request({
    url: '/userRole/getAllUserName',
    method: 'get',
  })
}

export function getAllUserRole() {
  return request({
    url: '/userRole/getAllUserRole',
    method: 'get',
  })
}

export function GetUserInfoById(id) {
  return request({
    url: '/user/queryUserById/'+ id,
    method: 'get',
  })
}

export function queryUserPage(page,size) {
  return request({
    url: '/user/queryUserPage/'+ page + '/' + size,
    method: 'get',
  })
}

export function ChangeUser(form) {
  return request({
    url: '/user/updateUser/',
    method: 'post',
    data: form
  })
}

export function ChangePassword(form) {
  return request({
    url: '/user/changePassword',
    method: 'post',
    data: form
  })
}

export function CreateVip(id,payid,order) {
  return request({
    url: '/user/CreateVip/'+ id + '/' + payid +'/' + order,
    method: 'get',
  })
}

export function UpdateIntegral(id,integral,order) {
  return request({
    url: '/user/UpdateIntegral/'+ id  +'/' + integral +'/' + order,
    method: 'get',
  })
}


export function deleteUserByUid(id) {
  return request({
    url: '/user/deleteUserByUid/'+ id ,
    method: 'get'
  })
}

export function changeRole(uid,roleId) {
  return request({
    url: '/user/changeRole/',
    method: 'post',
    data: {
      uid: uid,
      roleId: roleId
    }
  })
}

export function  getAdmin() {
  return request({
    url: '/user/getAdmin' ,
    method: 'get'
  })
}

export function  getUnAdmin() {
  return request({
    url: '/user/getUnAdmin' ,
    method: 'get'
  })
}

export function getUserCount() {
  return request({
    url: '/user/getUserCount',
    method: 'get'
  })
}
